home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / progargslib.lha / ProgArgs / Install < prev    next >
Text File  |  1995-04-08  |  28KB  |  685 lines

  1. ;;; ProgArgs installation utility
  2. ;;; (c) Copyright 1994 Dianne Hackborn
  3. ;;;
  4. ;;; Many thanks to Mikael Berglund for finding the Installer
  5. ;;; "deferred assign" bug.
  6. ;;;
  7. ;;; Installer and Installer project icon
  8. ;;; (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  9. ;;; Reproduced and distributed under license from Commodore.
  10. ;;; 
  11. ;;; INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  12. ;;; NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  13. ;;; OR RESPONSIBILITY IS ASSUMED.    
  14. ;;;
  15. ;;; Requires the following tooltypes or command line options:
  16. ;;; APPNAME=ProgArgs
  17.  
  18. ;**
  19. ;** Figure out version of library we are installing
  20. ;**
  21.  
  22. (set libvernum (getversion (cat "68000/" @app-name ".library")))
  23. (set libver (/ libvernum 65536))
  24. (set librev (- libvernum (* libver 65536) ) )
  25. (set libverstr ("%ld.%ld" libver librev) )
  26.  
  27. ;**
  28. ;** Figure out which CPU version to install
  29. ;**
  30.  
  31. (set cpu (database "cpu"))
  32. (if (= (strlen cpu) 5)
  33.     (   (set cpu (+ cpu))
  34.         (if (>= cpu 68020) (set cpu "68020") (set cpu "68000")) )
  35.     (set cpu "68000"))
  36.  
  37. ;**
  38. ;** Defines
  39. ;**
  40.  
  41. ; User level enum
  42. (set
  43.     USER_Novice  0
  44.     USER_Average 1
  45.     USER_Expert  2
  46. )
  47.  
  48. ; Installation set flags
  49. (set
  50.     INSTB_Main      0
  51.     INSTB_SupLibs   1
  52.     INSTB_Locale    2
  53.     INSTB_Headers   3
  54.     INSTB_Extras    4
  55.     INSTB_Autodocs  5
  56.     INSTB_Manuals   6
  57.     
  58.     INSTF_Main      (shiftleft 1 INSTB_Main)
  59.     INSTF_SupLibs   (shiftleft 1 INSTB_SupLibs)
  60.     INSTF_Locale    (shiftleft 1 INSTB_Locale)
  61.     INSTF_Headers   (shiftleft 1 INSTB_Headers)
  62.     INSTF_Extras    (shiftleft 1 INSTB_Extras)
  63.     INSTF_Autodocs  (shiftleft 1 INSTB_Autodocs)
  64.     INSTF_Manuals   (shiftleft 1 INSTB_Manuals)
  65. )
  66.  
  67. ;**
  68. ;** Define our global variables
  69. ;**
  70.  
  71. ; Full name of application
  72. (set app-name (cat @app-name " v" libverstr))
  73.  
  74. ; Required OS version
  75. (set need-version 37)
  76.  
  77. ; Find name of support shared library
  78. (foreach "Examples/Support" "#?.lib" (set @sup-lib @each-name))
  79.  
  80. ; Place to put shared libraries
  81. (if (= (run "assign LIBS0: exists" (safe)) 0)  ; Make sure not deferred so
  82.     (run "filenote LIBS0:" (safe)) )           ; that Installer doesn't crash
  83. (if (getassign "LIBS0")
  84.     (set sharedlib-dir "LIBS0:")
  85.     (set sharedlib-dir "LIBS:") )
  86.  
  87. ; Place to put locale catalogs
  88. (if (= (run "assign LOCALE: exists" (safe)) 0) ; Make sure not deferred so
  89.     (run "filenote LOCALE:" (safe)) )          ; that Installer doesn't crash
  90. (if (getassign "LOCALE")
  91.     (set locale-dir "LOCALE:Catalogs")
  92.     (set locale-dir "NIL:") )
  93.  
  94. ; Place to put header files
  95. (if (= (run "assign SC: exists" (safe)) 0)     ; Make sure not deferred so
  96.     (run "filenote SC:" (safe)) )              ; that Installer doesn't crash
  97. (if (getassign "SC")
  98.     (set include-dir "SC:Include")
  99.     (   (if (getassign "INCLUDE")
  100.             (set include-dir "INCLUDE:")
  101.             (set include-dir "NIL:")
  102.         )))
  103.  
  104. ; Place to put linked libraries
  105. (if (= (run "assign SC: exists" (safe)) 0)     ; Make sure not deferred so
  106.     (run "filenote SC:" (safe)) )              ; that Installer doesn't crash
  107. (if (getassign "SC")
  108.     (set linkedlib-dir "SC:Lib")
  109.     (   (if (getassign "LIB")
  110.             (set linkedlib-dir "LIB:")
  111.             (set linkedlib-dir "NIL:")
  112.         )))
  113.  
  114. ; Place to put autodocs
  115. (if (= (run "assign AUTODOCS: exists" (safe)) 0) ; Make sure not deferred so
  116.     (run "filenote AUTODOCS:" (safe)) )          ; that Installer doesn't crash
  117. (if (getassign "AUTODOCS")
  118.     (set autodoc-dir "AUTODOCS:")
  119.     (set autodoc-dir "NIL:") )
  120.  
  121. ; Place to put manuals
  122. (if (= (run "assign HELP: exists" (safe)) 0)   ; Make sure not deferred so
  123.     (run "filenote HELP:" (safe)) )            ; that Installer doesn't crash
  124. (if (getassign "HELP")
  125.     (set manuals-dir "HELP:")
  126.     (set manuals-dir "NIL:") )
  127.  
  128. ; Which options to install
  129. (set install-options %1111111111111111)
  130. (if (= locale-dir "NIL:")
  131.     (set install-options (bitand install-options (bitnot INSTF_Locale))) )
  132. (if (= include-dir "NIL:")
  133.     (set install-options (bitand install-options (bitnot INSTF_Headers))) )
  134. (if (= linkedlib-dir "NIL:")
  135.     (set install-options (bitand install-options (bitnot INSTF_Extras))) )
  136. (if (= autodoc-dir "NIL:")
  137.     (set install-options (bitand install-options (bitnot INSTF_Autodocs))) )
  138. (if (= manuals-dir "NIL:")
  139.     (set install-options (bitand install-options (bitnot INSTF_Manuals))) )
  140.  
  141. ; Set up default destination
  142. (set DefaultDest @default-dest) ; get current @default-dest
  143. (set @default-dest "")          ; assign it to something harmless to avoid putting log file somewhere stupid
  144.  
  145. ;**
  146. ;** Put up welcome message
  147. ;**
  148.  
  149. (welcome "    Welcome to the " app-name " installation utility.\n")
  150.  
  151. ;**
  152. ;** Define basic functions
  153. ;**
  154.  
  155. (procedure conv-version
  156.     (if (and (>= conv-version-num 33) (<= conv-version-num 40))
  157.         (set conv-version-name (select (- conv-version-num 33)
  158.                 "1.2" "1.3" "1.3" "2.0" "2.04" "2.1" "3.0" "3.1") )
  159.         (set conv-version-name (cat "v" conv-version-num))
  160.     )
  161. )
  162.  
  163. ; Check if the system is at least our needed version
  164. ; Lifted from AmiTCP installation...
  165. (procedure check-system-version
  166.     (set conv-version-num need-version)
  167.     (conv-version)
  168.     (set need-version-name conv-version-name)
  169.     
  170.     (set exec-version (/ (getversion) 65536))
  171.     (set conv-version-num exec-version)
  172.     (conv-version)
  173.     (set exec-version-name conv-version-name)
  174.     
  175.     (transcript "Running on exec version " exec-version " (" conv-version-name ").")
  176.     (if (< exec-version need-version)   ; check operating system version
  177.         (   (message
  178.                     "    " app-name " needs at least Exec version " need-version-name
  179.                     " to run.  You have only version " exec-version-name ".\n"
  180.                     "You can proceed with the installation, but consider "
  181.                     "installing " app-name " with the proper version of "
  182.                     "the operating system."
  183.                 (help
  184.                     "    " app-name " uses some system functions "
  185.                     "that are not present or functional in earlier system "
  186.                     "versions. Consider updating your system.\n"
  187.                     "    If you have a later version of operating system "
  188.                     "and are only now using older version: be sure to use "
  189.                     "only release " need-version-name " or newer with " app-name ". "
  190.                     "No damage happens if you run " app-name " with an "
  191.                     "earlier operating system, however.  It just "
  192.                     "refuses to run.\n") )
  193.             (transcript
  194.                 "User decided to continue installation while running "
  195.                 "on operating system release earlier than " need-version-name".") )
  196.     )
  197. )
  198.  
  199. ; Query for which archive modules to install
  200. (procedure askinstall
  201.     (if (= @user-level USER_Novice)
  202.         (set install-options (bitand install-options 
  203.                 (bitnot (bitor INSTF_Headers INSTF_Extras INSTF_Autodocs INSTF_Manuals)))
  204.         ))
  205.     ; Check if there are support libraries.
  206.     (set i 0)
  207.     (foreach "68000" "#?.library" (set i (+ i 1)))
  208.     (if (> i 1) (set has-support 1) (set has-support 0))
  209.     (if (not has-support)
  210.         (set install-options (bitand install-options (bitnot INSTF_SupLibs)))
  211.     )
  212.         ;(set install-options
  213.         ;   (bitor  (bitand install-options %1)
  214.         ;           (shiftright (bitand install-options %1111111111111100) 1))
  215.         ;))
  216.     (if has-support
  217.         (transcript "There are other shared libraries to install.\n")
  218.         (transcript "There aren't any other shared libraries to install.\n") )
  219.     ; Ask for options.
  220.     (set install-options (askoptions
  221.         (prompt (cat
  222.             "\nSelect which components of the " app-name " distribution to install:") )
  223.         (help
  224.             "Explanation of choices:\n\n"
  225.             "    \"" @app-name " Main Library\" -- The main " @app-name " shared library.\n\n"
  226.             (if has-support "    \"Support Libraries\" -- Misc. support libraries which are not required by the main library.\n\n")
  227.             "    \"Locale Catalogs\" -- Library localization catalogs for OS 2.1 or greater.\n\n"
  228.             "    \"Header Files\" -- Developer C header files.\n\n"
  229.             "    \"Extras Linked Library\" -- Developer extras linked library.\n\n"
  230.             "    \"Library Autodocs\" -- Developer function autodoc files.\n\n"
  231.             "    \"Programmer Manuals\" -- Developer manuals on programming " app-name ".\n"
  232.             "\n"
  233.             @askoptions-help)
  234.         (choices    (cat @app-name " Main Library")
  235.                     (if has-support "Support Libraries" "(Not available)")
  236.                     "Locale Catalogs"
  237.                     "Header Files"
  238.                     "Extras Linked Library"
  239.                     "Library Autodocs"
  240.                     "Programmer Manuals" )
  241.         (default install-options) ) )
  242.     (if (not has-support)
  243.         (set install-options (bitand install-options (bitnot INSTF_SupLibs)))
  244.     )
  245.         ;(set install-options
  246.         ;   (bitor  (bitand install-options %1)
  247.         ;           (shiftleft (bitand install-options %1111111111111110) 1))
  248.         ;))
  249. )
  250.     
  251. ; Query for CPU type of code to install
  252. (procedure askcpu
  253.     (set n 0)
  254.     (while  (set thiscpu (select n "68000" "68020" ""))
  255.             (   (if (= thiscpu cpu)
  256.                     (set defcpu n))
  257.                 (set n (+ n 1))
  258.             ))
  259.     (set cpu (select (askchoice
  260.         (prompt
  261.             "\nSelect CPU version of programs to install:")
  262.         (help
  263.             "Explanation of choices:\n"
  264.             "    \"68000\" -- Select this CPU for computers a 68000 or 68010 microprocessor.  If in doubt, this is the safe choice.\n"
  265.             "    \"68020\" -- Select this CPU for computers a 68020 or better microprocessor.  This allows the library to take advantage of features available in better processors.\n"
  266.             "\n"
  267.             @askchoice-help)
  268.         (choices "68000" "68020")
  269.         (default defcpu)
  270.     ) "68000" "68020"))
  271.     (transcript "Installing for " cpu " CPU.")
  272. )
  273.  
  274. ; Install the main library
  275. (procedure install-main
  276.     (if (= sharedlib-dir "NIL:")
  277.         (set sharedlib-dir ""))
  278.     (set sharedlib-dir (askdir
  279.         (prompt (cat
  280.             "In which drawer should the main " app-name " library be placed?") )
  281.         (help
  282.             "    The " @app-name " library needs to reside in a place where "
  283.             "applications may find it when they try to access the library.  "
  284.             "Shared libraries such as " @app-name " should normally be "
  285.             "installed in the standard \"LIBS:\" volume.\n"
  286.             "\n"
  287.             @askdir-help)
  288.         (default sharedlib-dir) ))
  289.     (transcript "Shared lib directory set to " sharedlib-dir)
  290.     (copylib
  291.         (source (tackon cpu (cat @app-name ".library")))
  292.         (dest sharedlib-dir)
  293.         (prompt (cat "\n\nInstalling \"" @app-name ".library\" to \""
  294.                         sharedlib-dir "\""))
  295.         (help
  296.             "Description of library:\n"
  297.             "    The main " app-name " shared library.  This library is required.\n"
  298.             "\n"
  299.             @copylib-help)
  300.         (confirm) )
  301. )   
  302.  
  303. ; Install the support libraries
  304. (procedure install-suplibs
  305.     (if (= sharedlib-dir "NIL:")
  306.         (set sharedlib-dir ""))
  307.     (set sharedlib-dir (askdir
  308.         (prompt (cat
  309.             "In which drawer should the support " app-name " libraries be placed?") )
  310.         (help
  311.             "    " app-name " comes with some support libraries which "
  312.             "may be used by applications and/or the example programs that "
  313.             "are included in the distribution.  They are not, however, required "
  314.             "by the main library.  These support libraries need to "
  315.             "reside in a place where applications can find them; "
  316.             "this should normally be \"LIBS:\", or the directory where the "
  317.             "main library is installed.\n"
  318.             "\n"
  319.             @askdir-help)
  320.         (default sharedlib-dir) ))
  321.     (transcript "Shared lib directory set to " sharedlib-dir)
  322.     (foreach "68000" (cat "(~(" @app-name ")).library")
  323.         (   (set LibName @each-name)
  324.             (if (>  (getversion (tackon cpu LibName))
  325.                     (getversion (tackon sharedlib-dir LibName)) )
  326.                 (copylib
  327.                     (source (tackon cpu LibName))
  328.                     (dest sharedlib-dir)
  329.                     (confirm)
  330.                     (prompt (cat "\n\nInstalling \"" LibName "\" to \""
  331.                                     sharedlib-dir "\""))
  332.                     (help
  333.                         "Description of library:\n"
  334.                         (if (= LibName "progargs.library")
  335.                             "    Routines for handling program CLI and Workbench arguments.\n")
  336.                         (if (= LibName "gadoutline.library")
  337.                             "    Routines for constructing graphical user interfaces.\n")
  338.                         "\n"
  339.                         @copylib-help
  340.                 ) )
  341.                 (transcript "Skipped " (tackon cpu Libname)
  342.                     " because " (tackon sharedlib-dir LibName) " was newer.") )
  343.         )
  344.     )
  345. )   
  346.  
  347. ; Install the localization catalogs
  348. (procedure install-locale
  349.     (if (= locale-dir "NIL:")
  350.         (set locale-dir ""))
  351.     (set locale-dir (askdir
  352.         (prompt (cat
  353.             "In which drawer should the " app-name " locale catalogs be placed?") )
  354.         (help
  355.             "    " app-name " includes catalog files for localization to "
  356.             "various languages.  Only the catalogs for the languages "
  357.             "which you will be running the library in are required; "
  358.             "if you will only be running it in English, no catalogs are needed.\n"
  359.             "    These catalogs should normally be placed in \"LOCALE:Catalogs\".\n"
  360.             "\n"
  361.             @askdir-help)
  362.         (default locale-dir) ) )
  363.     (transcript "Locale directory set to " locale-dir)
  364. ;    (set locale-types %0111)
  365. ;   (set locale-types (askoptions
  366. ;       (prompt
  367. ;           "\nSelect the types of language files to install:")
  368. ;       (help
  369. ;           "    " app-name " can install various types of localization files:\n"
  370. ;           "    \"Catalogs\"   -- These are the standard catalog files needed "
  371. ;           "for localization.  They are required for the library to localize itself.\n"
  372. ;           "    \"Templates\"  -- These are the .ct files from which catcomp "
  373. ;           "constructs the catalog files.  They are useful if you will be "
  374. ;           "making your own catalog, but not needed for localization.\n"
  375. ;           "    \"Descriptor\" -- These is the .cd file which describes all "
  376. ;           "of the localization strings used by the library.  Also not needed "
  377. ;           "for localization.\n"
  378. ;           "    \"Examples\"   -- These are the various catalog files for the "
  379. ;           "example programs.  You should not normally install these, as the "
  380. ;           "programs can find their own files if they are started from where "
  381. ;           "they are located in the main " @app-name " distribution folder.\n"
  382. ;           "\n"
  383. ;           @askoptions-help)
  384. ;       (choices "Catalogs" "Templates" "Descriptor" "Examples")
  385. ;       (default locale-types) ) )
  386.     (set locale-languages %1111111111111111)
  387.     (set locale-languages (askoptions
  388.         (prompt
  389.             "\nSelect the languages to install:")
  390.         (help
  391.             "    " app-name " includes catalog files for localization to "
  392.             "various languages.  Only the catalogs for the languages "
  393.             "which you will be running the library in are required; "
  394.             "if you will only be running it in English, no catalogs are needed.\n"
  395.             "\n"
  396.             @askoptions-help)
  397.         (choices "English")
  398.         (default locale-languages) ) )
  399.     (if locale-languages
  400.         (   (set i 0)
  401.             (while (set locale-name (select i "english" ""))
  402.                 (if (in locale-languages i)
  403.                     (   (copyfiles
  404.                             (prompt (cat "Copying " locale-name " catalog to \""
  405.                                          locale-dir "\""))
  406.                             (source (cat "Catalogs/" locale-name "/" @app-name ".catalog"))
  407.                             (dest (tackon locale-dir locale-name))
  408.                             (help
  409.                                 "This is the catalog which contains "
  410.                                 locale-name " versions of the library's messages.\n"
  411.                                 "\n"
  412.                                 @copyfiles-help)
  413.                             (confirm))
  414.                         ) )
  415.                 (set i (+ i 1)) )
  416.         ) )
  417. )   
  418.  
  419. ; Install the library header files
  420. (procedure install-headers
  421.     (if (= include-dir "NIL:")
  422.         (set include-dir ""))
  423.     (set include-dir (askdir
  424.         (prompt (cat
  425.             "In which drawer should the " app-name " compiler header files be placed?"))
  426.         (help
  427.             "    " app-name " includes standard OS-style header files for "
  428.             "developing applications with the library.  These should be placed "
  429.             "in a directory within your compiler's search path, such as "
  430.             "\"SC:Include\" for SAS/C users.\n"
  431.             "    Files will be copied into the \"clib\", \"fd\", \"proto\", "
  432.             "\"pragmas\", and \"libraries\" sub-directories within this folder.\n"
  433.             "\n"
  434.             @askdir-help)
  435.         (default include-dir) ))
  436.     (transcript "Include directory set to " include-dir)
  437.     (set header-files %1111111111111111)
  438.     (set i 0)
  439.     (while (set header-name (select i "clib" "fd" "proto" "pragmas" "libraries" ""))
  440.         (if (in header-files i)
  441.             (   (copyfiles
  442.                     (prompt (cat "\n\nCopying \"" header-name
  443.                                 "\" directory to \""
  444.                                 (tackon include-dir header-name) "\""))
  445.                     (source (tackon "Includes" header-name))
  446.                     (dest (tackon include-dir header-name))
  447.                     (help
  448.                         "These are compiler header files needed to write "
  449.                         "applications using " app-name ".\n"
  450.                         "\n"
  451.                         @copyfiles-help)
  452.                     (confirm)
  453.                     (all))
  454.                 ) )
  455.         (set i (+ i 1))
  456.     )
  457. )
  458.  
  459. ; Install the library extras linked lib
  460. (procedure install-linklib
  461.     (if (= linkedlib-dir "NIL:")
  462.         (set linkedlib-dir ""))
  463.     (set linkedlib-dir (askdir
  464.         (prompt (cat
  465.             "In which drawer should the " app-name " support shared library be placed?") )
  466.         (help
  467.             "    " app-name " includes a shared library which contains many "
  468.             "extra functions that may be useful to a developer using the library.  "
  469.             "The most important of these is a set of function built on top of "
  470.             "the basic shared library, which provide a standard application "
  471.             "framework for handling multiple windows, menus, program arguments, "
  472.             "and standard program operations such as screen jumping, iconification, "
  473.             "preferences, etc.  It also includes SAS/C autoinitialization modules "
  474.             "for all of the libraries and stubs for the varargs functions in "
  475.             "the library along with other miscellaneous things.\n"
  476.             "\n"
  477.             @askdir-help)
  478.         (default linkedlib-dir) ))
  479.     (transcript "Linked lib directory set to " linkedlib-dir)
  480.     (copyfiles
  481.         (prompt (cat "Copying \"Examples/Support/" @sup-lib "\" to \""
  482.                         linkedlib-dir "\""))
  483.         (source (cat "Examples/Support/" @sup-lib ))
  484.         (dest linkedlib-dir)
  485.         (help
  486.             "This is a linked library of additional support routines.\n"
  487.             "\n"
  488.             @copyfiles-help)
  489.         (confirm))
  490.     (set OldLevel (user USER_Expert))
  491.     (if (askbool
  492.             (prompt (cat
  493.                 "NOTE:\n"
  494.                 "\n"
  495.                 "If you use any modules in the " app-name " support link libarary "
  496.                 "(which was installed as \"" (tackon linkedlib-dir @sup-lib) "\"), "
  497.                 "you will need to place the associated header files in a location "
  498.                 "where your programs can find them.\n"
  499.                 "\n"
  500.                 "Would you like these headers installed for you?"))
  501.             (help (cat
  502.                 "The " app-name " support library "
  503.                 "includes many associated header files, located in "
  504.                 "the distribution's \"Examples/Support\" folder, which "
  505.                 "define the library's modules.  You will need to place these "
  506.                 "in a location where your compiler can "
  507.                 "find them, if you will be using any of the modules from the "
  508.                 "library which have header files.  The headers are not needed for "
  509.                 "the low-level support modules such as the auto-constructors "
  510.                 "and varargs entry stubs.  A good place for these files is in a "
  511.                 "\"support\" directory within "
  512.                 "the main compiler include directory.\n"
  513.                 "\n"
  514.                 @askbool-help))
  515.             (default 1))
  516.         (   (user OldLevel)
  517.             (if (= include-dir "NIL:")
  518.                 (set include-dir ""))
  519.             (set include-dir (askdir
  520.                 (prompt (cat
  521.                     "In which drawer should the " app-name " support header files be placed?  "
  522.                     "A sub-directory named \"support\" will be created in this directory."))
  523.                 (help (cat
  524.                     "    " app-name " includes standard header files for the included "
  525.                     "support link library.  These are required if you will be using any "
  526.                     "of the modules contained in the library.  These headers should be placed "
  527.                     "in a directory within your compiler's search path, such as "
  528.                     "\"SC:Include\" for SAS/C users.\n"
  529.                     "    Files will be copied into a \"support\" sub-directory, which "
  530.                     "will be created in the include directory which you select.\n"
  531.                     "\n"
  532.                     @askdir-help))
  533.                 (default include-dir) ))
  534.             (transcript "Include directory set to " include-dir)
  535.             (set support-dir (tackon include-dir "support"))
  536.             (foreach "Examples/Support" ("#?.h")
  537.                 (   (set HeaderName @each-name)
  538.                     (if (>= (getversion (tackon "Examples/Support" HeaderName))
  539.                             (getversion (tackon support-dir HeaderName)) )
  540.                         (copyfiles
  541.                             (source (tackon "Examples/Support" HeaderName))
  542.                             (dest support-dir)
  543.                             (prompt (cat "\n\nInstalling \"" HeaderName "\" to \""
  544.                                             support-dir "\""))
  545.                             (help
  546.                                 "This is a header file for the " app-name " support "
  547.                                 "library.\n"
  548.                                 "\n"
  549.                                 @copyfiles-help
  550.                         ) )
  551.                         (transcript "Skipped " (tackon "Examples/Support" HeaderName)
  552.                             " because " (tackon support-dir HeaderName) " was newer.") )
  553.                 )
  554.             )
  555.         )
  556.     )
  557.     (user OldLevel)
  558. )
  559.  
  560. ; Install the library autodocs
  561. (procedure install-autodocs
  562.     (if (= autodoc-dir "NIL:")
  563.         (set autodoc-dir ""))
  564.     (set autodoc-dir (askdir
  565.         (prompt (cat
  566.             "In which drawer should the " app-name " autodocs be placed?") )
  567.         (help
  568.             "    " app-name " includes standard Amiga autodocs for all of its "
  569.             "functions.  These should be installed with all of your other "
  570.             "autodoc files, if you would like them.\n"
  571.             "\n"
  572.             @askdir-help)
  573.         (default autodoc-dir) ))
  574.     (transcript "Autodoc directory set to " autodoc-dir)
  575.     (copyfiles
  576.         (prompt (cat "Copying \"Includes/" @app-name ".doc\" to \""
  577.                         autodoc-dir "\""))
  578.         (source (cat "Includes/" @app-name ".doc"))
  579.         (dest autodoc-dir)
  580.         (help
  581.             "This is a standard Autodocs-style file documenting the library functions.\n"
  582.             "\n"
  583.             @copyfiles-help)
  584.         (confirm))
  585. )
  586.  
  587. ; Install the library manuals
  588. (procedure install-manuals
  589.     (if (= manuals-dir "NIL:")
  590.         (set manuals-dir ""))
  591.     (if (exists "Docs/Tutorial.ps") (set has-tutorial 1) (set has-tutorial 0))
  592.     (set manuals-dir (askdir
  593.         (prompt (cat
  594.             "In which drawer should the " app-name " manuals be placed?") )
  595.         (help
  596.             "    " app-name " includes an AmigaGuide hypertext version of "
  597.             "its autodocs as its primary manual"
  598.             (if has-tutorial
  599.                 ", along with a Postscript file which introduces the basic library concepts.  These"
  600.                 ".  This")
  601.             " should be installed where you keep your other programming documentation.\n"
  602.             "\n"
  603.             @askdir-help)
  604.         (default manuals-dir) ))
  605.     (transcript "Manuals directory set to " manuals-dir)
  606.     (copyfiles
  607.         (prompt (cat "Copying \"Includes/" @app-name ".guide\" to \""
  608.                     manuals-dir "\""))
  609.         (source (cat "Includes/" @app-name ".guide"))
  610.         (dest manuals-dir)
  611.         (help
  612.             "This is the library autodoc in a hypertext form which can "
  613.             "be read with AmigaGuide or MultiView.\n"
  614.             "\n"
  615.             @copyfiles-help)
  616.         (confirm)
  617.         (infos) )
  618.     (if has-tutorial
  619.         (copyfiles
  620.             (prompt (cat "Copying \"Docs/Tutorial.doc\" to \""
  621.                             (tackon manuals-dir (cat @app-name "-Tutorial.ps")) "\""))
  622.             (source "Docs/Tutorial.ps")
  623.             (dest manuals-dir)
  624.             (newname (cat @app-name "-Tutorial.ps"))
  625.             (help
  626.                 "This is a standard Postscript file which contains a basic "
  627.                 "tutorial on using " app-name ".\n"
  628.                 "\n"
  629.                 @copyfiles-help)
  630.             (confirm)
  631.             (infos))
  632.     )
  633. )
  634.  
  635. ;**
  636. ;** Main installation code
  637. ;**
  638.  
  639. (transcript "Installing " app-name ".")
  640. (transcript "Default shared library dir: " sharedlib-dir)
  641. (transcript "Default locale dir: " locale-dir)
  642. (transcript "Default includes dir: " include-dir)
  643. (transcript "Default linked library dir: " linkedlib-dir)
  644. (transcript "Default autodoc dir: " autodoc-dir)
  645. (transcript "Default manuals dir: " manuals-dir)
  646. (transcript "Support shared library: " @sup-lib)
  647.  
  648. (check-system-version)      ; Make sure OS is correct version
  649. (askinstall)                ; Query user for which parts to install
  650.  
  651. (if (bitand install-options (bitor INSTF_Main INSTF_SupLibs))
  652.     (askcpu)                ; Query user for cpu to install
  653. )
  654.  
  655. (if (bitand install-options INSTF_Main)
  656.     (install-main)          ; Install main library
  657. )
  658.  
  659. (if (bitand install-options INSTF_SupLibs)
  660.     (install-suplibs)       ; Install support libraries
  661. )
  662.  
  663. (if (bitand install-options INSTF_Locale)
  664.     (install-locale)        ; Install locale catalogs
  665. )
  666.  
  667. (if (bitand install-options INSTF_Headers)
  668.     (install-headers)       ; Install header files
  669. )
  670.  
  671. (if (bitand install-options INSTF_Extras)
  672.     (install-linklib)       ; Install extras linked library
  673. )
  674.  
  675. (if (bitand install-options INSTF_Autodocs)
  676.     (install-autodocs)      ; Install plain autodocs
  677. )
  678.  
  679. (if (bitand install-options INSTF_Manuals)
  680.     (install-manuals)       ; Install AmigaGuide, Postscript manuals
  681. )
  682.  
  683. (run (cat "About" @app-name))
  684. (exit app-name " has been successfully installed.")
  685.